(function() {
  var scale = 1.0;
  var ratio = 1;
  var userAgent = navigator.userAgent;
  var match = userAgent.match(/Android/);
  var iosLt5 = navigator.userAgent.match(/iphone4|iphone5/i);
  if (!!match || !!iosLt5) {
    document.write(
      '<meta name="viewport" content="initial-scale=1, width=device-width, maximum-scale=1, user-scalable=no">'
    );
    document.documentElement.style.fontSize = "50px";
  } else {
    if (window.devicePixelRatio >= 2) {
      scale *= 0.5;
      ratio *= 2;
      var text = '<meta name="viewport" content="initial-scale=' + scale +
        ', maximum-scale=' + scale + ', minimum-scale=' + scale +
        ', width=device-width, user-scalable=no" />';
      document.write(text);
      document.documentElement.style.fontSize = 50 * ratio + "px";
    }
  }
})();
